import { request } from "./request"

//查询商品列表
export const commodity_List = (data = {}) => {
    return request('get', '/shop/goods/listGoods', data, true);
}
//查询商品的类型列表
export const commodityTypeList = (data = {}) => {
    return request('get', '/shop/goods/listClassify', data, true);
}

//查询购物车列表
export const shopping_List = (data = {}) => {
    return request('get', '/shop/cart/listUserCard', data, true);
}

//查询商品详情页面
export const shopping_Detail = (data = {}) => {
    return request('get', '/shop/goods/getGoodsInfo', data, true);
}

//查询购物车数量
export const shoppingCart_Num = (data = {}) => {
    return request('get', '/shop/cart/listCartCount', data, true);
}

//商品加入到购物车
export const shoppingCart_Add = (data = {}) => {
    return request('post', '/shop/cart/addUserCard', data, true);
}

//预支付
export const advance_Paymen = (data = {}) => {
    return request('post', '/shop/cart/listCartToOrder', data, true);
}

//创建订单
export const order_Create = (data = {}) => {
    return request('post', '/shop/order/createOrder', data, true);
}

//查询订单列表
export const order_List = (data = {}) => {
    return request('get', '/shop/order/listUserOrder', data, true);
}

//查询订单详情
export const order_Detail = (data = {}) => {
    return request('get', '/shop/order/getUserOrderInfo', data, true);
}

//查询地址列表
export const address_List = (data = {}) => {
    return request('get', '/shop/address/getUserAddress', data, true);
}

//添加地址
export const address_Add = (data = {}) => {
    return request('post', '/shop/address/addUserAddress', data, true);
}

//查询收货人详情
export const address_Info = (data = {}) => {
    return request('get', '/shop/address/getUserAddressInfo', data, true);
}

//修改地址
export const address_Upload = (data = {}) => {
    return request('put', '/shop/address/editUserAddress', data, true);
}

//删除地址
export const address_Delete = (data) => {
    return request('get', '/shop/address/removeUserAddress', data, true);
}

//购物车列表商品数量修改
export const shoppingCartNum_opt = (data) => {
    return request('put', '/shop/cart/updateCount', data, false);
}
//购物车列表删除
export const shoppingCart_Delete = (id) => {
    return request('delete', `/shop/cart/removeUserCard/${id}`, null, true);
}

//查询收货人信息
export const consignee_Info = (data) => {
    return request('get', '/shop/address/getDefault', data, true);
}

//查询订单合计金额
export const orderTotal_money = (data) => {
    return request('post', '/shop/cart/getPreCartPrice', data, false);
}

//统一下单，并组装所需支付参数
export const unifiedOrderPlacement = (data) => {
    return request('post', '/wx/pay/createOrder', data, true);
}

//支付成功回调接口
export const paymentSuccessCallback = (data) => {
    return request('get', '/shop/order/updateUserOrder', data, true);
}



